package com.wanxi.servlet;

import com.alibaba.fastjson2.JSONObject;
import com.wanxi.dto.ResultDTO;
import com.wanxi.service.CompanyService;
import com.wanxi.service.NavService;
import com.wanxi.service.impl.CompanyServiceImpl;
import com.wanxi.service.impl.NavServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/home")
public class CompanyFindByIdServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        CompanyService companyService = new CompanyServiceImpl();

        NavService navService=new NavServiceImpl();
        ResultDTO resultDTONavList=navService.getNavListModel();

        ResultDTO resultDTOCompany = companyService.getCompanyModel();
        resp.getWriter().println(JSONObject.toJSONString(resultDTOCompany));
        resp.getWriter().println(JSONObject.toJSONString(resultDTONavList));
    }
}
